-
Notifications
You must be signed in to change notification settings - Fork 53
Test against symfony versions #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
We would like to keep tests for beta and the 2 latest Symfony LTS. Ping @weaverryan. This does not quite work.. When Symfony 4.0 is released we do no longer test SF3.4... I will do another attempt later. |
I think I found the "perfect" travis.yml. The current state of the PR has
When Symfony 4 is released and I do not change my library requirements, Travis will test the following:
If I update my requirements to
FYI @stof, @nicolas-grekas |
.travis.yml
Outdated
- php: 5.4 | ||
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci" | ||
|
||
env: DEPENDENCIES="minimun" COVERAGE=true TEST_COMMAND="composer test-ci" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minimum
.travis.yml
Outdated
|
||
# Test LTS versions | ||
- php: 7.1 | ||
env: DEPENDENCIES="symfony/lts:v2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clever use of the package, great discovery!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if some bundle authors actively only want to support 2 Symfony versions at one time? What's what we're talking about in FOSUserBundle FriendsOfSymfony/FOSUserBundle#2639 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can still install a mixed set of 2.7 and 2.8 components. What about using symfony/symfony:v2.8.*
which will force any symfony component to be in it's v2.8 version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I realize I was unclear! What I really mean was: in FOSUserBundle, they only want to support Symfony 3 and Symfony 4 (and then perhaps just do bug-fixes fro 2.7/2.8 branches).
In that situation, I guess they would just remove this one line and change the minimum dependencies matrix to 5.5 (from 5.4)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the Symfony 2 LTS job and bump your min requirement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@weaverryan they in FOSUserBundle refers to only one maintainer of the bundle actually. I had not even seen this discussion yet (it was hidden in the middle of the thousand notifications I received during the hackday)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re requiring symfony/symfony: that hides problems if we miss depending on some symfony components. if we do that, we should require each component we use in the configured version instead. (which duplicates composer.json, so still not very nice)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still have the "Test the latest stable release" job which does not alter the composer.json
.
Ping @alcaeus |
.travis.yml
Outdated
- php: 7.1 | ||
|
||
# Test LTS versions | ||
- php: 7.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Food for thought: test the LTS releases against the lowest common version they and this package supports. I'd say that people on LTS releases are less likely to always run on the latest PHP version, so testing against a lower version might be more comparable to real-world usage.
.travis.yml
Outdated
allow_failures: | ||
# Latest beta is allowed to fail. | ||
- php: 7.1 | ||
env: DEPENDENCIES="beta" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the latest beta should not be allowed to fail. Probably we really should allow it to fail, but I'm afraid people will not "notice" the failure. I'd rather push them to be a bit more proactive by noticing it :)
.travis.yml
Outdated
- php: 7.1 | ||
env: DEPENDENCIES="symfony/lts:v3" | ||
|
||
# Latest beta release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest testing against dev rather than beta (especially if you allow them to fail):
- if something breaks in an early Symfony 4.1 version, you may have 5 months to report it or adapt, instead of a few weeks/days
- most of your other deps don't release beta at all, so you will not catch anything until it reaches other jobs too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
excellent, thanks for this cleanup!
lowest version build fails. i guess that is something about composer.json, maybe phpspec itself?
(and lets drop php 5.4 and 5.5 in the next minor version ;-) )
.travis.yml
Outdated
@@ -27,18 +19,44 @@ branches: | |||
matrix: | |||
fast_finish: true | |||
include: | |||
# Minimum supported PHP and Symfony version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minimum supported PHP
is confusing here
.travis.yml
Outdated
|
||
allow_failures: | ||
# Latest beta is allowed to fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong comment
.travis.yml
Outdated
|
||
allow_failures: | ||
# Latest beta is allowed to fail. | ||
- php: 7.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to specify the PHP version here. It will avoid having to keep it in sync when changing the version used by DEPENDENCIES="dev"
.travis.yml
Outdated
@@ -27,18 +19,44 @@ branches: | |||
matrix: | |||
fast_finish: true | |||
include: | |||
# Minimum supported PHP and Symfony version | |||
- php: 7.1 | |||
env: DEPENDENCIES="minimum" COVERAGE=true TEST_COMMAND="composer test-ci" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we actually run the coverage on the min deps ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd do coverage on the latest stable
src/Plugin/ContentTypePlugin.php
Outdated
@@ -102,7 +102,7 @@ private function isJson($stream) | |||
|
|||
json_decode($stream->getContents()); | |||
|
|||
return json_last_error() == JSON_ERROR_NONE; | |||
return JSON_ERROR_NONE == json_last_error(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strict comparison ?
.travis.yml
Outdated
before_install: | ||
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi | ||
- if [ "$DEPENDENCIES" = "minimum" ]; then COMPOSER_FLAGS="--prefer-stable --prefer-lowest"; fi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would instead just set $COMPOSER_FLAGS
above
.travis.yml
Outdated
before_install: | ||
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi | ||
- if [ "$DEPENDENCIES" = "minimum" ]; then COMPOSER_FLAGS="--prefer-stable --prefer-lowest"; fi; | ||
- if [ "$DEPENDENCIES" = "dev" ]; then composer config minimum-stability dev; fi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename the var to $STABILITY
(or something like that) here
.travis.yml
Outdated
before_install: | ||
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi | ||
- if [ "$DEPENDENCIES" = "minimum" ]; then COMPOSER_FLAGS="--prefer-stable --prefer-lowest"; fi; | ||
- if [ "$DEPENDENCIES" = "dev" ]; then composer config minimum-stability dev; fi; | ||
- if [[ $DEPENDENCIES == *"/"* ]]; then composer require --no-update $DEPENDENCIES; fi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and then just test for $DEPENDENCIES
not being empty here
Thank you for the review. An Im sorry for keeping you review the actual travis file here and the "best practice" in the docs. I've made the updates now |
.travis.yml
Outdated
@@ -27,18 +19,46 @@ branches: | |||
matrix: | |||
fast_finish: true | |||
include: | |||
- php: 7.1 | |||
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" DEPENDENCIES="doctrine/instanciator:^1.05" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's 1.0.5
;)
.travis.yml
Outdated
@@ -27,18 +19,46 @@ branches: | |||
matrix: | |||
fast_finish: true | |||
include: | |||
- php: 7.1 | |||
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" DEPENDENCIES="doctrine/instanciator:^1.0.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also instantiator
. Apart from that, any reason why you're locking the version of it? If anything breaks with --prefer-lowest
because an older version is installed, it needs to be fixed in that package and should probably be added here as a comment so the workaround can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is adding the dependency for this one case, so its changing composer.json and thus needs a version constraint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see that, the question is: why do you need it as an explicit dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From Slack:
@fbourigault [11:18 AM]
$ composer why doctrine/instantiator
phpspec/phpspec 2.4.0 requires doctrine/instantiator (^1.0.1)
phpspec/prophecy 1.4.0 requires doctrine/instantiator (^1.0.2) (edited)
But it’s for unmaintained versions of those packagesages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thank you for explaining 👍
.travis.yml
Outdated
@@ -27,18 +19,47 @@ branches: | |||
matrix: | |||
fast_finish: true | |||
include: | |||
- php: 7.0 | |||
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" DEPENDENCIES="doctrine/instantiator:^1.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doctrine/instantiator:^1.1
require PHP 7.1.
Thank you for all the reviews! |
…luz) This PR was submitted for the master branch but it was merged into the 4.0 branch instead (closes #8701). Discussion ---------- Added a good example of a travis file After a lot of discussions with people at Symfony con I came up with a "perfect" travis file. See php-http/client-common#90 (comment) for info. Btw, should I make a table explaining what we really test? (Like on the client-common PR) Commits ------- 93bdb86 Rewords 4bd8e65 Minor updates bc9a43f use ./ before vendor ae322b7 typo 1017897 Using better cache syntax 36ca90b Using PHPUNIT_FLAGS 18e4a18 Added back php-versions 05bf09d Moved coverage to PHP 7.2 with latest deps bfdd064 Fixed minor things 3e2b876 Fixed typos and created more variables a62bcb7 Added comment and install simple-phpunit deps 65f91df Use tilde or composer validate will never pass 179abb0 Updated according to feedback a281604 Typo 2418834 Added a good example travis file
What's in this PR?
I want to test with different versions of the options-resolver.
Why?
Im experimenting to see if the symfony/lts is something that should be used in travis.yml for more bundles.
#SymfonyConHackday2017